module.exports = {
    root: true,
    parser: '@typescript-eslint/parser',
    // 排除测试文件
    ignorePatterns: ['**/*.test.js', '**/*.test.jsx', '**/*.test.ts', '**/*.test.tsx'],
    extends: ['prettier', 'airbnb', 'plugin:import/typescript'],
    parserOptions: {
        ecmaVersion: 6,
        sourceType: 'module',
        ecmaFeatures: {
            jsx: true,
        },
    },
    plugins: [
        'prettier'
    ],
    env: {
        browser: true,
        node: true,
    },
    rules: {
        'class-methods-use-this': 0,
        'space-before-function-paren': 1,
        'prettier/prettier': 'error',
        'jsx-quotes': 0,
        'object-curly-newline': 0,
        indent: [2, 4, { SwitchCase: 1 }],
        'max-len': [
            'error',
            120,
            4,
            {
                ignoreUrls: true,
                ignoreComments: false,
                ignoreRegExpLiterals: true,
                ignoreStrings: true,
                ignoreTemplateLiterals: true,
            },
        ],
        'implicit-arrow-linebreak': 0,
        'no-unused-vars': 1,
        'no-useless-constructor': 0,
        'no-console': 0,
        'react/prop-types': 0,
        'react/jsx-indent': [2, 4, { checkAttributes: true }],
        'react/jsx-indent-props': [2, 4],
        'jsx-a11y/no-noninteractive-tabindex': 0,
        'import/no-unresolved': 0,
        'react/jsx-props-no-spreading': 'off',
        'jsx-a11y/anchor-is-valid': 'off',
        'react/destructuring-assignment': 0,
        'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx'] }],
        'import/extensions': 'off',
        'import/prefer-default-export': 'off',
        'function-paren-newline': 'off',
        'func-names': 0,
        'click-events-have-key-events': 0,
        'jsx-a11y/click-events-have-key-events': 0,
        'jsx-a11y/no-static-element-interactions': 0,
        'jsx-a11y/no-noninteractive-element-interactions': 0,
        'import/no-extraneous-dependencies': 0,
        'react/jsx-no-useless-fragment': 0,
        'prefer-destructuring': 0,
        'react/no-unused-prop-types': 0,
        'operator-linebreak': 'off',
        'no-param-reassign': 1,
    },
    overrides: [
        {
            files: ['**/*.ts', '**/*.tsx'],
            extends: [
                'plugin:react/recommended',
                'plugin:@typescript-eslint/recommended',
                'plugin:react-hooks/recommended',
                'plugin:jsx-a11y/recommended',
            ],
            rules: {
                indent: [2, 4, { SwitchCase: 1 }],
                'max-len': [
                    'error',
                    120,
                    4,
                    {
                        ignoreUrls: true,
                        ignoreComments: false,
                        ignoreRegExpLiterals: true,
                        ignoreStrings: true,
                        ignoreTemplateLiterals: true,
                    },
                ],
                'no-shadow': 'off',
                'react/require-default-props': 'off',
                'react/react-in-jsx-scope': 'off',
                'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
                '@typescript-eslint/no-empty-interface': 'off',
                '@typescript-eslint/no-shadow': ['error'],
                '@typescript-eslint/ban-ts-comment': 0,
                '@typescript-eslint/explicit-module-boundary-types': 0,
                'jsx-a11y/no-noninteractive-element-interactions': 0,
            },
        },
    ],
};
